<template>
	<div class="school-hot">
		<div class="hot-title">
			<p class="hot-title-p">热度排行</p>
		</div>
		<div class="hot_school_content">
			<div class="lset academy_item_box clearfix" v-for="(item,index) in majorRec"
				@click="goToMajorInfo(item.dataId)">
				
				<a >
					<div class="academy_item_title clearfix">
						<p class="academy_num ">
							{{index + 1}}</p>
						<p class="ellipsis cursor">{{item.majorName}}</p>
					</div>
					<div class="academy_item_value">
					<i class="layui-icon layui-icon-fire " style="color: #FF5722;">
					</i>&nbsp;{{item.majorClout}}</div>
				</a>
			</div>
		</div>
	</div>
</template>

<script>
	export default{
		name: 'majorRecommend',
		data(){
			return{
				majorRec: [],
			}
		},
		methods:{
			// 前往查看专业信息
			goToMajorInfo(majorId){
				const { href } = this.$router.resolve({
				      path: `/MajorInfo`,
				      query: {
				        dataId: majorId,
				      }
				    });
				window.open(href, '_blank');
			},
			// 从后台获取推荐专业信息
			getCloseScoreSchool(){
				this.$axios.post("/major/recommend")
					.then(rst => {
						// console.log(rst.data);
						this.majorRec = rst.data;
					}).catch(ex => {
						console.log(ex);
					});
			},
		},
		created() {
			this.getCloseScoreSchool();
		},
		mounted() {
			layui.use('element', function() {
				var element = layui.element;
		
				//…
			});
		},
		components: {
			
		}
	}
</script>

<style scoped>
	.school-hot {
		width: 300px;
		margin-top: 50px;
		margin-left: 20px;
	}
	
	.school-hot .hot-title {
		height: 47px;
		line-height: 47px;
	}
	
	.school-hot .hot-title .hot-title-p {
		float: left;
		font-size: 20px;
		color: #000000;
		font-weight: bold;
	}
	
	.school-hot .hot_school_content {
		height: 900px;
		border: 1px solid #EEEEEE;
		padding: 20px;
	}
	
	.school-hot .hot_school_content .check_more {
			width: 98px;
			height: 39px;
			border: 1px solid #EEEEEE;
			line-height: 39px;
			text-align: center;
			font-size: 14px;
			color: #555555;
			margin: 0 auto;
		}
	.academy_item_box {
		margin-bottom: 27px;
		height: 18px;
		line-height: 18px;
	}
	
	
	 .academy_item_box .academy_item_title {
		float: left;
	}
	
	.academy_item_box .academy_item_title .academy_num {
		float: left;
		margin: 0;
		width: 18px;
		text-align: center;
		background: #1eb450;
		opacity: 0.9;
		color: white;
		font-size: 12px;
		margin-right: 17px;
	}
	
	.academy_item_box .academy_item_title .ellipsis {
		float: left;
		margin: 0;
		font-size: 18px;
		color: #000000;
		transition: all 0.4s;
		max-width: 187px;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.academy_item_value{
		float: right;
		font-size: 18px;
		color: #000000;
		transition: all 0.4s;
	}
</style>
